home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / PCI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  6.2 KB  |  206 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        PCI.h
  3.  
  4.      Contains:    PCI Bus Interfaces.
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __PCI__
  18. #define __PCI__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __NAMEREGISTRY__
  24. #include <NameRegistry.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49. /* Types and structures for accessing the PCI Assigned-Address property.*/
  50.  
  51. #define kPCIAssignedAddressProperty "assigned-addresses"
  52.  
  53. enum {
  54.     kPCIRelocatableSpace        = 0x80,
  55.     kPCIPrefetchableSpace        = 0x40,
  56.     kPCIAliasedSpace            = 0x20,
  57.     kPCIAddressTypeCodeMask        = 0x03,
  58.     kPCIConfigSpace                = 0,
  59.     kPCIIOSpace                    = 1,
  60.     kPCI32BitMemorySpace        = 2,
  61.     kPCI64BitMemorySpace        = 3
  62. };
  63.  
  64. typedef UInt8                             PCIAddressSpaceFlags;
  65.  
  66. enum {
  67.     kPCIDeviceNumberMask        = 0x1F,
  68.     kPCIFunctionNumberMask        = 0x07
  69. };
  70.  
  71. typedef UInt8                             PCIDeviceFunction;
  72. typedef UInt8                             PCIBusNumber;
  73. typedef UInt8                             PCIRegisterNumber;
  74.  
  75. struct PCIAssignedAddress {
  76.     PCIAddressSpaceFlags             addressSpaceFlags;
  77.     PCIBusNumber                     busNumber;
  78.     PCIDeviceFunction                 deviceFunctionNumber;
  79.     PCIRegisterNumber                 registerNumber;
  80.     UnsignedWide                     address;
  81.     UnsignedWide                     size;
  82. };
  83. typedef struct PCIAssignedAddress        PCIAssignedAddress;
  84. typedef PCIAssignedAddress *            PCIAssignedAddressPtr;
  85. #define GetPCIIsRelocatable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIRelocatableSpace)
  86. #define GetPCIIsPrefetchable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIPrefetchableSpace)
  87. #define GetPCIIsAliased( AssignedAddressPtr )            ((AssignedAddressPtr)->addressSpaceFlags & kPCIAliasedSpace)
  88. #define GetPCIAddressSpaceType( AssignedAddressPtr )    ((AssignedAddressPtr)->addressSpaceFlags & kPCIAddressTypeCodeMask)
  89. #define GetPCIBusNumber( AssignedAddressPtr )            ((AssignedAddressPtr)->busNumber)
  90. #define GetPCIDeviceNumber( AssignedAddressPtr )        (((AssignedAddressPtr)->deviceFunctionNumber >> 3) & kPCIDeviceNumberMask)
  91. #define GetPCIFunctionNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->deviceFunctionNumber & kPCIFunctionNumberMask)
  92. #define GetPCIRegisterNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->registerNumber)
  93.  
  94.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  95.                                                                                             #pragma parameter __D0 EndianSwap16Bit(__D0)
  96.                                                                                             #endif
  97. EXTERN_API( UInt16 )
  98. EndianSwap16Bit                    (UInt16                 data16)                                ONEWORDINLINE(0xE158);
  99.  
  100.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  101.                                                                                             #pragma parameter __D0 EndianSwap32Bit(__D0)
  102.                                                                                             #endif
  103. EXTERN_API( UInt32 )
  104. EndianSwap32Bit                    (UInt32                 data32)                                THREEWORDINLINE(0xE158, 0x4840, 0xE158);
  105.  
  106. EXTERN_API( OSErr )
  107. ExpMgrConfigReadByte            (RegEntryIDPtr             node,
  108.                                  LogicalAddress         configAddr,
  109.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0620, 0xAAF3);
  110.  
  111. EXTERN_API( OSErr )
  112. ExpMgrConfigReadWord            (RegEntryIDPtr             node,
  113.                                  LogicalAddress         configAddr,
  114.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0621, 0xAAF3);
  115.  
  116. EXTERN_API( OSErr )
  117. ExpMgrConfigReadLong            (RegEntryIDPtr             node,
  118.                                  LogicalAddress         configAddr,
  119.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0622, 0xAAF3);
  120.  
  121. EXTERN_API( OSErr )
  122. ExpMgrConfigWriteByte            (RegEntryIDPtr             node,
  123.                                  LogicalAddress         configAddr,
  124.                                  UInt8                     value)                                THREEWORDINLINE(0x303C, 0x0523, 0xAAF3);
  125.  
  126. EXTERN_API( OSErr )
  127. ExpMgrConfigWriteWord            (RegEntryIDPtr             node,
  128.                                  LogicalAddress         configAddr,
  129.                                  UInt16                 value)                                THREEWORDINLINE(0x303C, 0x0524, 0xAAF3);
  130.  
  131. EXTERN_API( OSErr )
  132. ExpMgrConfigWriteLong            (RegEntryIDPtr             node,
  133.                                  LogicalAddress         configAddr,
  134.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x0625, 0xAAF3);
  135.  
  136. EXTERN_API( OSErr )
  137. ExpMgrIOReadByte                (RegEntryIDPtr             node,
  138.                                  LogicalAddress         ioAddr,
  139.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0626, 0xAAF3);
  140.  
  141. EXTERN_API( OSErr )
  142. ExpMgrIOReadWord                (RegEntryIDPtr             node,
  143.                                  LogicalAddress         ioAddr,
  144.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0627, 0xAAF3);
  145.  
  146. EXTERN_API( OSErr )
  147. ExpMgrIOReadLong                (RegEntryIDPtr             node,
  148.                                  LogicalAddress         ioAddr,
  149.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0628, 0xAAF3);
  150.  
  151. EXTERN_API( OSErr )
  152. ExpMgrIOWriteByte                (RegEntryIDPtr             node,
  153.                                  LogicalAddress         ioAddr,
  154.                                  UInt8                     value)                                THREEWORDINLINE(0x303C, 0x0529, 0xAAF3);
  155.  
  156. EXTERN_API( OSErr )
  157. ExpMgrIOWriteWord                (RegEntryIDPtr             node,
  158.                                  LogicalAddress         ioAddr,
  159.                                  UInt16                 value)                                THREEWORDINLINE(0x303C, 0x052A, 0xAAF3);
  160.  
  161. EXTERN_API( OSErr )
  162. ExpMgrIOWriteLong                (RegEntryIDPtr             node,
  163.                                  LogicalAddress         ioAddr,
  164.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x062B, 0xAAF3);
  165.  
  166. EXTERN_API( OSErr )
  167. ExpMgrInterruptAcknowledgeReadByte (RegEntryIDPtr         entry,
  168.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0411, 0xAAF3);
  169.  
  170. EXTERN_API( OSErr )
  171. ExpMgrInterruptAcknowledgeReadWord (RegEntryIDPtr         entry,
  172.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0412, 0xAAF3);
  173.  
  174. EXTERN_API( OSErr )
  175. ExpMgrInterruptAcknowledgeReadLong (RegEntryIDPtr         entry,
  176.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0413, 0xAAF3);
  177.  
  178. EXTERN_API( OSErr )
  179. ExpMgrSpecialCycleWriteLong        (RegEntryIDPtr             entry,
  180.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x0419, 0xAAF3);
  181.  
  182. EXTERN_API( OSErr )
  183. ExpMgrSpecialCycleBroadcastLong    (UInt32                 value)                                THREEWORDINLINE(0x303C, 0x021A, 0xAAF3);
  184.  
  185.  
  186. #if PRAGMA_STRUCT_ALIGN
  187.     #pragma options align=reset
  188. #elif PRAGMA_STRUCT_PACKPUSH
  189.     #pragma pack(pop)
  190. #elif PRAGMA_STRUCT_PACK
  191.     #pragma pack()
  192. #endif
  193.  
  194. #ifdef PRAGMA_IMPORT_OFF
  195. #pragma import off
  196. #elif PRAGMA_IMPORT
  197. #pragma import reset
  198. #endif
  199.  
  200. #ifdef __cplusplus
  201. }
  202. #endif
  203.  
  204. #endif /* __PCI__ */
  205.  
  206.